#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
const int N = 5e4 + 10;
int tree[N];
long long n;
int lowbit(int x)
{
	return x & (-x);
}
void add(int i, int j)
{
	for (int k = i; k <= n; k += lowbit(k)) {
		tree[k] += j;
	}
}
void sub(int i, int j)
{
	for (int k = i; k <= n; k += lowbit(k)) {
		tree[k] -= j;
	}
}

int Q(int x)
{
	int sum = 0;
	for (int i = x; i; i -= lowbit(i)) {
		sum += tree[i];
	}
	return sum;
}
int main()
{
	long long t = 0;
	scanf("%lld", &t);
	int T = 1;
	while (t--) {
		cout << "Case " << T << ":" << endl;
		scanf("%lld", &n);
		memset(tree, 0, sizeof(tree));
		for (int i = 1; i <= n; i++) {
			int x;
			scanf("%lld", &x);
			add(i, x);
		}
		char s[10];
		while (~scanf("%s", s)) {
			if (s[0]=='A') {
				long long i, j;
				scanf("%lld%lld", &i, &j);
				//cout << i << " " << j << endl;
				add(i, j);
			}
			else if (s[0] == 'S') {
				long long i, j;
				scanf("%lld%lld", &i, &j);
				sub(i, j);
			}
			else if(s[0]=='Q') {
				long long i, j;
				scanf("%lld%lld", &i, &j);
				if (i == j) {
					cout << Q(i) << endl;
				}
				else {
					cout << Q(j) - Q(i - 1) << endl;
				}
			}
			else {
				break;
			}
		}
		T++;
	}
	return 0;
}